
$(refresh);

function refresh(){
	listHLX();
	$("#nbqname").text(param.nbqname);
}


var psid = param.psid;
var dataHand = new AjaxHandler();
function listHLX(){
	
	$.proAjax({
		url:"/mobile/hlxlist/",
		data:{},
		success: function (data){
			 icount = data.icount || 16;
			 low = data.low;
			var ic = data.ic;
			dataHand.arrayAddToHtml("hlx-model",data.hlxs,null,function(elm,datas){
				var lsc = elm.find("#listcontext");
				for(var a=1;a<=icount;a++){
					var _id = psid + "_HLX_YC_"+this.collectid+"_"+ic+a;
					var html = '<div class="mui-col-sm-4 mui-col-xs-4">'+
							'<span class="col-gog">i'+a+'：</span>'+
							'<span class="col-06" id="'+_id+'"></span>'+
							'</div>';
					lsc.append(html);
				}
			});
			fillData();
		}
	});
}
function fillData(){
	var ids = [];
	$(".mui-col-xs-4 span[id]").each(function(){
		ids.push(this.id);
	});
	$.proAjax({
		url:"/mobile/hlx/real",
		data:{ids:ids+""},
		success: function (data){
			var key;
			for(key in data){
				$("#"+key).text(data[key]);
			}
			var radian = data['radian'];
			var radian_L = data['radian_L'];
			var radian_H = data['radian_H'];
			//判断汇流箱偏低值
				
				var elm =$(".mui-col-xs-4").parent();
				elm.each(function(){
					var sum=0;
					 var num=0;
					$(this).find(".col-06").each(function(index,e){
						var val=$(e).text();
						if(+val==0 && +radian>=+radian_H){//辐射强度小于40时不显示支路为零
							$(e).css("color","red");
						}else if(val=='备用'){
							$(e).css("color","black");
						}else{
							sum+= +val;
							num++;
						}
					});
					$(this).find(".col-06").each(function(index,e){
						var val=$(e).text();
						var avg = sum/num*low;
						if(val!="备用" && +val>0 && +val<avg && +radian>=+radian_L){//辐射强度小于120时不显示支路偏低
							$(e).css("color","#f48a34");
						}
					});
				})
		}
	});
}




